package com.example.keshe0337.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.keshe0337.entity.ParkingRecord;
import com.example.keshe0337.entity.User;

import java.util.List;

@Dao
public interface ParkingRecordDao {
    @Insert
    long insertPR(ParkingRecord parkingRecord);

    @Delete
    void deletePR(ParkingRecord parkingRecord);

    @Update
    void updatePR(ParkingRecord parkingRecord);

    @Query("SELECT * FROM parking_record WHERE id = :rId")
    ParkingRecord getPRById(Long rId);

    @Query("SELECT * FROM parking_record WHERE user_id = :uId AND end_time != 0")
    List<ParkingRecord> getPRByUId(Long uId);


    @Query("SELECT * FROM parking_record")
    List<ParkingRecord> getAllPRs();


}
